// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "LyraAbilityCost.h"
#include "ScalableFloat.h"
#include "Templates/SubclassOf.h"

#include "LyraAbilityCost_InventoryItem.generated.h"

struct FGameplayAbilityActivationInfo;
struct FGameplayAbilitySpecHandle;

class ULyraGameplayAbility;
class ULyraInventoryItemDefinition;
class UObject;
struct FGameplayAbilityActorInfo;
struct FGameplayTagContainer;

/**
 * 表示需要消耗一定数量库存物品的成本
 */
UCLASS(meta=(DisplayName="Inventory Item"))
class ULyraAbilityCost_InventoryItem : public ULyraAbilityCost
{
	GENERATED_BODY()

public:
	ULyraAbilityCost_InventoryItem();

	//~ULyraAbilityCost interface
	/**
	 * 检查是否能支付成本
	 * @param Ability 游戏能力
	 * @param Handle 能力规格句柄
	 * @param ActorInfo 演员信息
	 * @param OptionalRelevantTags 可选相关标签容器
	 * @return 是否能支付成本
	 */
	virtual bool CheckCost(const ULyraGameplayAbility* Ability, const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, FGameplayTagContainer* OptionalRelevantTags) const override;
	
	/**
	 * 应用成本（消耗物品）
	 * @param Ability 游戏能力
	 * @param Handle 能力规格句柄
	 * @param ActorInfo 演员信息
	 * @param ActivationInfo 激活信息
	 */
	virtual void ApplyCost(const ULyraGameplayAbility* Ability, const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo) override;
	//~End of ULyraAbilityCost interface

protected:
	/** 要消耗的物品数量（基于能力等级） */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=AbilityCost)
	FScalableFloat Quantity; //数量

	/** 要消耗的物品定义 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=AbilityCost)
	TSubclassOf<ULyraInventoryItemDefinition> ItemDefinition; //物品定义
};